
<!--
- Author:  lalala.
- Date:    2018/11/8 02.
- File:    modifymobile.
-->
<template>
  <div class="Web_Box">
    <div @click="back" class="Topmenu"><i class="iconfont icon-youjiantou"><a href=""></a></i>
      <h1>修改绑定手机</h1>
      <span></span>
    </div>
    <div class="login_dl">
      <div class="login_ipt1">
        <i class="iconfont icon-denglu_shoujihao1"></i><input style="background-color: #fff;" type="number" v-model="memberInfo.member_mobile" disabled="disabled">
        <span style="width: 120px;">
          <message-code type="2" :tel="memberInfo.member_mobile"  :callback="handleMessageCode"></message-code>
        </span>
      </div>
      <div class="login_ipt1">
        <i class="iconfont icon-wangjimima_yanzhengma"></i><input type="number" v-model="code" placeholder="输入验证码">
      </div>
      <!--<div class="login_ipt1">-->
        <!--<i class="iconfont icon-wangjimima_xinmima"></i><input type="number" v-model="password" placeholder="输入新密码">-->
      <!--</div>-->

    </div>
    <div class="login_btn1" style="padding: 3rem 10px;">
      <span @click="goModifyNext">下一步</span>
    </div>
  </div>
</template>

<script>
  import {mapModules, mapRules} from 'vuet'
  import messageCode from '../../components/message-code.vue'
  export default{
    mixins: [
      mapModules({memberInfo: 'memberInfo'}),
      mapRules({once: 'memberInfo'})
    ],
    data() {
      return {
        code: ''
      }
    },
    components: {
      'message-code': messageCode
    },
    methods: {
      back() {
        this.$router.go(-1)
      },
      goModifyNext() {
        console.log(this.memberInfo)
        var postData = {}
        postData.mobile = this.memberInfo.member_mobile
        postData.code = this.code
        if (postData.code == '') {
          this.$toast('请输入验证码！')
          return
        }
        this.$request.modifyMobile(postData).then(data => {
          window.localStorage.removeItem('fkmid')
          this.$router.replace({name: 'modify-mobilenext'})
        }).catch(e => {
          this.$toast(e.msg)
        })
        // this.$router.push({name: 'modify-mobilenext'})
      },
      handleMessageCode(code) {
        this.check_mobile = code
      }
    }
  }
</script>

<style>

</style>
